/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import org.jsoup.Jsoup;

import java.io.IOException;
import java.util.Scanner;

/**
 * <p>Project: jse2302 - DictDemo
 * <p>Powered by webrx On 2023-06-12 09:31:02
 * <p>Created by IntelliJ IDEA
 *
 * @author  webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class DictDemo {
    public static void main(String[] args) throws IOException {
        var sc = new Scanner(System.in);
        while(true) {
            System.out.print("请输入词汇：");
            var w = sc.next();
            if(w.equals("0")){
                System.out.println("程序结束");
                break;
            }
            var u = "https://cn.bing.com/dict/s?q=" + w;
            var t = Jsoup.connect(u).get().select("span[class=def b_regtxt]").get(0).text();
            System.out.printf("%s:[%s]%n", w, t);
        }
    }
}
